{template head}
<script type="text/javascript" src="{STATICDIR}third/plupload/plupload.full.min.js"></script>
<script type="text/javascript">
function submitcheck()
{
	return true;
}

function saveInfo()
{
	if(!submitcheck())
	{
		return;
	}
	var url = '{SITE_URL}ajax/index.php?m=saveGonggao';
	var content = layedit.getContent(index);
	$('#demo').html(content);
	
	var data = $('#savedata').serialize();
		
	var callback = function(data)
	{
		if(data.sign == -2)
		{
			window.location = data.url;
		}
		else
		{
			if(data.sign == 1)
			{
				//添加成功,返回列表页
				layer.alert(data.msg,function(){
					window.location = $('#gotoList').attr('href');
				});
			}
			else
			{
				if(data.msg)
				{
					layer.msg(data.msg);
				}
				else
				{
					layer.msg('操作失败');
				}
			}
		}
	};
	makeAjax('post',url,data,callback);
}

</script>
<style>
	.layui-layedit{width: 540px;margin-left: 154px;}
</style>
<body>
<div class="wrapper">
	<div class="crumbs"><span style="margin: 0 5px;color: #333;font-size: 14px;">内容管理</span> &gt;<a id="gotoList" href="{SITE_URL}index.php?a=gonggaoM&m=list">公告管理</a> &gt; <span>{$pagetitle}</span><a style="float:right;font-size:13px;" href="javascript:history.go(-1);">返回</a></div>
	
	<div class="container_tit clearfix mb20 ft14">
	
	<form id="savedata">
		<input type="hidden" name="id" value="{$gonggao[id]}" />
		<h2 class="form_tit">公告信息</h2>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">公告标题：</label>
				<input placeholder="20个字以内" type="text" id="title" name="title" value="{$gonggao[title]}" class="text w340" />
			</p>
		</div>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">发布时间：</label>
				<input type="text" class="w340 text" style="width:200px;" class="text" format='date' name='start' id="start" value="{$gonggao['start']}" placeholder="请输入日期">
			</p>
		</div>
		<div class="form_item clearfix">
		    <p class="clearfix">
				<label class="name">公告内容：</label>
				<textarea id="demo" class="text w340" style="display: none;height:200px" name="content">{$gonggao[content]}</textarea>
				<script>
				var layedit,index;
				layui.use('layedit', function(){
				  layedit = layui.layedit;
				  index = layedit.build('demo',{height: 380,uploadImage: {url: '{SITE_URL}ajax/object.php', type: 'post'}}); //建立编辑器
				  
				});
				</script>
			</p>
		</div>
		<div class="form_item clearfix">
			<p class="clearfix" style="height: 28px;line-height: 28px;">
				<label class="name">是否启用：</label>
				<input style="vertical-align: middle;" {if $gonggao['status'] == '1' || empty($gonggao['status'])}checked{/if} class="checkbox" type="radio" name="status" value="1" />
				<label for="resort_index" class="mr15">禁用</label>
				<input style="vertical-align: middle;" {if $gonggao['status'] == '2'}checked{/if} class="checkbox" type="radio" name="status" value="2" />
				<label for="resort_index">启用</label>
			</p>
		</div>
        <div class="form_item clearfix" style="padding-top: 20px;>
			<p class="clearfix">
			    <input type="button" class="btnblue" value="提交" onclick="saveInfo();" />
			</p>
		</div>
    </form>
    </div>
</div>
{template foot}